const app = getApp();
Component({
  /**
   * 组件的一些选项
   */
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  /**
   * 组件的对外属性
   */
  properties: {
    bgColor: {
      type: String,
      default: ''
    }, 
    isCustom: {
      type: [Boolean, String],
      default: false
    },
    isBack: {
      type: [Boolean, String],
      default: false
    },
    NotShowModal: {
      type: [Boolean, String],
      default: false
    },
    bgImage: {
      type: String,
      default: ''
    },
  },
  /**
   * 组件的初始数据
   */
  data: {
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,
    Custom: app.globalData.Custom
  },
  /**
   * 组件的方法列表
   */
  methods: {
    BackPage() {
      this.switchPage()
    },
    toHome(){
      this.switchPage()
    },
    switchPage() {
      console.log("ccccccccccccccccccccccc");
      console.log(this.properties.NotShowModal);
      if (this.properties.NotShowModal) {
        wx.reLaunch({
          url: '/pages/index/index',
        })
      }else {
        wx.showModal({
          title: '提示',
          content: '是否回到主页，当前运动数据将会丢失！',
         async success(res) {
            if (res.confirm) {
              wx.reLaunch({
                url: '/pages/index/index',
              })
            }
          }
        })
      }


    }
  }
})